package com.sys.sysserver.controller;


import com.sys.sysserver.domain.dto.UserLoginDTO;
import com.sys.sysserver.service.RegisterService;
import com.sys.sysserver.utils.Result;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/user")
@RequiredArgsConstructor
public class RegisterController {
    private final RegisterService registerService;

    @PostMapping("/register")
    public Result register(@RequestBody UserLoginDTO userLoginDTO) throws Exception{
        log.info("\n\n正在执行注册: {}\n\n",userLoginDTO);
        registerService.register(userLoginDTO);
        return Result.success("注册成功");
    }
}
